/* 
 * File:   timer.cpp
 * Author: monkey
 * 
 * Created on November 18, 2011, 3:00 PM
 */

#include "timer.h"
#include <time.h>
#include <unistd.h>

timer::timer() {
    t = time(0);
    s_time = localtime(&t);

    //    void getCurrentTime() {
    //        const int MAXLEN = 80;
    //        char s[MAXLEN];
    //        time_t t = time(0);
    //        strftime(s, MAXLEN, "%m/%d/%Y\n%H:%M", localtime(&t));
    //        std::cout << s << '\n';
    //    }


}

//timer::timer(const timer& orig) {
//}

timer::~timer() {
}

int timer::get_current_day() {
    return s_time->tm_mday;
}

int timer::get_current_hour() {
    return s_time->tm_hour;
}

int timer::get_current_year() {
    return s_time->tm_year;
}

int timer::get_current_month() {
    return s_time->tm_mon;
}

int timer::get_current_minute() {
    return s_time->tm_min;
}

int timer::get_current_second() {
    return s_time->tm_sec;
}

char* timer::get_current_date() {
    const int MAXLEN = 80;
    char s[MAXLEN];
    strftime(s, MAXLEN, "%Y-%m-%d", s_time);
    return s;
}